package com.wang.dynamic.controller;

import com.wang.dynamic.mapper.source1.UserMapper1;
import com.wang.dynamic.mapper.source2.UserMapper2;
import com.wang.dynamic.model.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: wangning1@abupdate.com
 * @date: 2023-12-18 18:38
 **/
@RestController
public class UserController {

    @Resource
    private UserMapper1 userMapper1;

    @Resource
    private UserMapper2 userMapper2;

    /**
     * 数据源1
     *
     * @return
     */
    @GetMapping("/listBySource1")
    public List<User> listBySource1(){
        return userMapper1.list();
    }

    /**
     * 数据源2
     *
     * @return
     */
    @GetMapping("/listBySource2")
    public List<User> listBySource2(){
        return userMapper2.list();
    }
}